A Prime Formula

A team of mathematicians in Canada and Japan discovered this remarkable polynomial in 1976. Let its 26 variables a, b, c, - z range over the non-negative integers and it will generate all prime numbers.

The snag is that it will sometimes produce negative numbers, which must be ignored. But every positive result will be prime, and every prime can be generated by some set of 26 non-negative integers.

(k+2)(1- [wz+h+j -q]2- [(gk+2g +k+1)(h+ j)+h-z] 2- [16(k+1 )3(k+2 )(n+1) 2+1-f2 ]2- [2n+p+ q+z-e]2 - [e3(e +2)(a+ 1)2+1- a2]2- [(a2- 1)y2+1- x2]2- [16r2y 4(a2-1 )+1-u2] 2- [n+l+v -y]2- [(a2- 1)l2+1 -m2]2 - [ai+k+1 -l-i]2- [((a+ u2(u2 -a))2- 1)(n+4 dy)2+1 -(x+cu )2]2- [p+l(a -n-1)+b( 2an+2a- n2-2n-2) -m]2- [q+y(a -p-1)+s (2ap+2a- p2-2p- 2)-x]2- [z+pl( a-p)+t( 2ap-p2 -1)-pm] 2)>0

(James P. Jones et al., "Diophantine Representation of the Set of Prime Numbers," American Mathematical Monthly 83:6 [1976], 449-464.)

This formula was posted on Futility Closet on 11/10/20.


The calculator below will use any numbers input. If a number has not been assigned to a variable a random number between 1 and 1,000,000,000 will be selected.

I have not been able to produce any primes. Clearly all of the squared terms in the right set of parentheses must be zero. Otherwise the result is negative. Each of those terms must be simultaneously solved and that will yield a prime that is two larger than k. Solving that system of equations looks like a nightmare. The random method below produces no primes in any reasonable period of time.




Up to 26 integers can be chosen for the 26 variables: